<?php

// include your container

/**
 * Read from the dictionary
 *
 * @param array $params
 * @param object $smarty
 * @return string
 */
function smarty_function_i18n(array $params, &$smarty)
{
	// m - module
	// k - key
	// p - params
	// v - values

	if ( ! isset($params['k']))
	{
		$smarty->trigger_error("Theres no ::key:: in the smarty ::dict:: function!" .
							" Filename: " . $smarty->_plugins['function']['dict'][1]);
	}

	$combined = array();
	if (isset($params['p']) && isset($params['v']))
	{
		$combined = array_combine( explode(',', $params['p']), explode(',', $params['v']) );
	}
	
	return Container::getI18n()->get($params['k'], $combined);
}

# EOF
